Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

198
Vistas
React Native "Styled-components" not working

I am fairly new to react-native and javascript, I recently attemped to use styled components in react native, which allows you to style components using css-like syntax. In this case, I want to change the name of a View to div and then style it, but div is not being used and therefore the styles does not apply.

Here is my code:

import { Text, View } from 'react-native';
import styled from 'styled-components/native';

const div = styled.View` // "div" is not being used
  flex: 1; 
  justify-content: center; 
  align-items: center; 
  background-color: pink; 
`

function ScreenTimePage() {
  return (
    <div>
    <Text> Some Text </Text>
    </div>
  );
}

How can I solve this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

React requires that component names start with a capital letter so it can distinguish them from HTML elements.

Call it Div instead (better yet, name it something that describes what it is for and can’t be confused with an HTML element).

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda